//
//  HomeRmdSectionTwoSubCell.m
//  copyrightTrading
//
//  Created by edz on 2020/10/9.
//  Copyright © 2020 郭子一. All rights reserved.
//

#import "HomeRmdSectionTwoSubCell.h"

@interface HomeRmdSectionTwoSubCell ()

@property (nonatomic, strong) UIImageView *img;
@property (nonatomic, strong) UILabel *contentLabel;

@end

@implementation HomeRmdSectionTwoSubCell
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.contentView.backgroundColor = UIColor.whiteColor;
        [self setupUI];
    }
    return self;
}

- (void)setupUI
{
    self.img = [[UIImageView alloc] init];
//    self.img.image = [UIImage imageNamed:@"MineHeaderImg"];
    self.img.backgroundColor = UIColor.brownColor;
    self.img.layer.masksToBounds = YES;
    self.img.layer.cornerRadius = 6;
    [self.contentView addSubview:self.img];
    [self.img mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.right.bottom.offset(0);
    }];
    
    UIView *mohuView = [UIView new];
    mohuView.backgroundColor = RGB_VALUE(0x000000);
    mohuView.alpha = 0.6;
    mohuView.layer.masksToBounds = YES;
    mohuView.layer.cornerRadius = 6;
    [self.img addSubview:mohuView];
    [mohuView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.offset(0);
    }];
    
    self.contentLabel = [UILabel new];
    self.contentLabel.text = @"视频内容";
    self.contentLabel.font = JSS_MEDIUM_FONT(15);
    self.contentLabel.textColor = RGB_VALUE(0xFFFFFF);
    self.contentLabel.textAlignment = NSTextAlignmentCenter;
    self.contentLabel.numberOfLines = 2;
    [self.contentView addSubview:self.contentLabel];
    [self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.offset(5);
        make.left.offset(0);
        make.right.offset(0);
        make.height.mas_equalTo(80);
    }];
    
    NSMutableAttributedString *mutAttribts = [[NSMutableAttributedString alloc]initWithString:@"《泉城夜宴》\n济南新版城市宣传片"];
    [mutAttribts setAttributes:@{NSFontAttributeName : JSS_MEDIUM_FONT_2}
                         range:NSMakeRange(0, 6)];
    self.contentLabel.attributedText = mutAttribts;
}

- (void)setDataDic:(NSDictionary *)dataDic
{
    _dataDic = dataDic;
    [self.img m_setImageWithUrlString:dataDic[@"thumb"] placeholder:@"placeholderImg"];
    self.contentLabel.text = dataDic[@"title"];
}

@end
